Skip to content

docs(wasm-sdk): clarify aggregate groupBy behavior - #4576

Open
thephez wants to merge 5 commits into
v4.2-devfrom
fix/wasm-sdk-aggregate-groupby-jsdoc
Open

docs(wasm-sdk): clarify aggregate groupBy behavior#4576
thephez wants to merge 5 commits into
v4.2-devfrom
fix/wasm-sdk-aggregate-groupby-jsdoc

Conversation

@thephez

@thephez thephez commented Sep 1, 2026

Copy link
Copy Markdown
Collaborator

Issue being fixed or feature implemented

The DocumentsQuery.groupBy declaration described the option exclusively as a count-query setting, despite the type also being shared by document sum and average queries. This caused generated declaration-based documentation to show count-specific wording for those methods.

What was done?

  • Updated the DocumentsQuery.groupBy JSDoc in packages/wasm-sdk/src/queries/document.rs to describe all aggregate queries.
  • Documented the ungrouped return values for getDocumentsCount, getDocumentsSum, and getDocumentsAverage.
  • Corrected related internal comments that described groupBy as count-only.

How Has This Been Tested?

No build or automated tests were run because this change only updates documentation comments.

Breaking Changes

None.

Checklist:

  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas
  • I have added or updated relevant unit/integration/functional/e2e tests
  • I have added "!" to the title and described breaking changes in the corresponding section if my code contains any
  • I have made corresponding changes to the documentation if needed

For repository code-owners and collaborators only

  • I have assigned this pull request to a milestone

Summary by CodeRabbit

  • Documentation
    • Clarified groupBy documentation for count, sum, and average aggregate results.
    • Documented the result shapes for ungrouped aggregate queries.
    • Updated terminology to consistently describe aggregate queries.
    • Improved guidance for interpreting grouped and ungrouped aggregate results without changing query behavior.

@coderabbitai

coderabbitai Bot commented Sep 1, 2026

Copy link
Copy Markdown
Contributor

Review Change StackReview Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Advanced

Run ID: c58433de-3462-43ba-8dcf-bfac767802b1

📥 Commits

Reviewing files that changed from the base of the PR and between b84975e and 4ebd14e.

📒 Files selected for processing (1)
  • packages/wasm-sdk/src/queries/document.rs
🚧 Files skipped from review as they are similar to previous changes (1)
  • packages/wasm-sdk/src/queries/document.rs

Included review availability: Your plan provides up to 1 included review per hour; 0 remain after this review.


📝 Walkthrough

Walkthrough

Updated groupBy documentation and related Rust comments to describe count, sum, and average aggregate results. No executable behavior changed.

Changes

Aggregate query documentation

Layer / File(s) Summary
Align aggregate query documentation
packages/wasm-sdk/src/queries/document.rs
The groupBy documentation now covers ungrouped count, sum, and average results. Rust comments use aggregate-query terminology and identify group_by as an aggregate-query option.

Priority: ⚪ Not assessed

Estimated code review effort: 1 (Trivial) | ~2 minutes

Merge Risk: ⚪ Minimal · up to 15c4f

This updates WASM SDK aggregate-query documentation and internal comments without changing runtime behavior. No current merge-readiness risk is identified.

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 1 functions across 1 files. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly and concisely describes the documentation update for aggregate groupBy behavior in the WASM SDK.
✨ Finishing Touches 💡 1
📝 Generate docstrings 💡
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/wasm-sdk-aggregate-groupby-jsdoc

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@thepastaclaw

thepastaclaw commented Sep 1, 2026

Copy link
Copy Markdown
Collaborator

✅ Final review complete — Phase 1 only — no blockers (commit 15c4f7a) · triage: trivial

@thepastaclaw thepastaclaw left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Final validation — GLM Flash + Sol

The public groupBy JSDoc accurately documents count, sum, and average behavior, including each ungrouped result shape. One adjacent internal comment remains count-specific even though it describes ordering shared by all three aggregate surfaces.

Source: reviewer 1: glm-5.3-flash (agent: phase1-reviewer, role: general); reviewer 2: gpt-5.6-sol (agent: phase2-reviewer, role: general); final verifier: gpt-5.6-sol (agent: sol-verifier, role: final-verifier)

Review provenance

  • Phase 1 reviewers (GLM Flash): glm-5.3-flash — general (completed); agent phase1-reviewer
  • Fresh verifier (Sol): gpt-5.6-sol — final-verifier; agent sol-verifier
  • Phase 2 reviewers (Sol): gpt-5.6-sol — general (completed); agent phase2-reviewer

💬 1 nitpick(s)

1 additional finding(s) omitted (not in diff).

🤖 Prompt for all review comments with AI agents
These findings are from an automated code review. Verify each finding against the current code and only fix it if needed.

In `packages/wasm-sdk/src/queries/document.rs`:
- [NITPICK] packages/wasm-sdk/src/queries/document.rs:221-224: Shared ordering comment still refers only to count results
  This shared input comment still calls the ordered entries "count results," despite the PR's stated goal of replacing count-only terminology for options shared by count, sum, and average queries. The sum and average dispatchers also derive their ordering direction from the first `orderBy` clause and propagate it to split-result ordering and proof walk order, so the comment should describe aggregate query results rather than count results.

@codecov

codecov Bot commented Sep 7, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 87.75%. Comparing base (5f1e0cc) to head (15c4f7a).
⚠️ Report is 1 commits behind head on v4.2-dev.

Additional details and impacted files
@@             Coverage Diff              @@
##           v4.2-dev    #4576      +/-   ##
============================================
+ Coverage     86.36%   87.75%   +1.38%     
============================================
  Files          2766     2796      +30     
  Lines        366105   363858    -2247     
============================================
+ Hits         316191   319287    +3096     
+ Misses        49914    44571    -5343     
Components Coverage Δ
dpp 89.11% <ø> (+1.82%) ⬆️
drive 86.58% <ø> (+2.33%) ⬆️
drive-abci 89.98% <ø> (+0.32%) ⬆️
sdk ∅ <ø> (∅)
dapi-client ∅ <ø> (∅)
platform-version ∅ <ø> (∅)
platform-value 92.92% <ø> (ø)
platform-wallet ∅ <ø> (∅)
drive-proof-verifier 49.78% <ø> (ø)
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@thepastaclaw thepastaclaw left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Final review — Phase 1 only (trivial change)

The updated public JSDoc accurately describes count, sum, and average grouping behavior, including the empty-string key and each aggregate value shape. One adjacent internal comment on the shared aggregate query input still incorrectly describes the ordering mechanism as count-only, contrary to the PR's stated documentation cleanup.

Source: reviewer 1: glm-5.3-flash (agent: phase1-reviewer, role: ffi-engineer); final verifier: gpt-5.6-sol (agent: sol-verifier, role: final-verifier)

Review provenance

  • Triage: trivial by gpt-6-astra (effort low) — The diff only updates JSDoc and internal comments describing aggregate groupBy behavior, with no changes to runtime logic, types, or serialization.
  • Phase 1 reviewers: glm-5.3-flash — ffi-engineer (completed, effort high); agent phase1-reviewer
  • Fresh verifier: gpt-5.6-sol — final-verifier; agent sol-verifier
  • Phase 2 reviewers: not run (triage rated this change trivial); this review comments and never approves

💬 1 nitpick(s)

1 additional finding(s) omitted (not in diff).

🤖 Prompt for all review comments with AI agents
These findings are from an automated code review. Verify each finding against the current code and only fix it if needed.

In `packages/wasm-sdk/src/queries/document.rs`:
- [NITPICK] packages/wasm-sdk/src/queries/document.rs:230-233: Shared ordering comment still describes count results only
  This comment is attached to the query input shared by count, sum, and average, but still calls the behavior "order direction for count results." The first `orderBy` clause controls split-result ordering and proof walk direction for all three aggregate surfaces: `count_proof_helpers.rs`, `sum_proof_helpers.rs`, and `average_proof_helpers.rs` each derive `left_to_right` from `order_by_clauses.first()`. Update the wording to cover aggregate results consistently with the other internal comments changed by this PR.
Out-of-scope follow-up suggestions (1)

These are valid observations, but they are outside this PR's scope and should be handled in separate issues or author/maintainer-requested PRs rather than blocking this review.

  • Surface the aggregate empty-string sentinel key as a typed constant in TS declarations — Out of scope — exporting a new typed API constant would be a broader, pre-existing binding-surface redesign. This documentation-only PR now explicitly tells consumers that the ungrouped aggregate entry uses the empty-string key.
    • Follow-up: Consider creating a separate issue or author/maintainer-requested PR for this.

thephez and others added 2 commits September 9, 2026 17:00
The comment on the shared DocumentsQueryInput described the first orderBy clause as controlling only count results, but sum and average derive their proof walk direction the same way.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
@coderabbitai

coderabbitai Bot commented Sep 9, 2026

Copy link
Copy Markdown
Contributor

Note

GitHub couldn't provide a complete incremental comparison for this pull request, so CodeRabbit is performing a full review instead. This review may take a little longer.

@thepastaclaw thepastaclaw left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Final review — Phase 1 only (trivial change)

The documentation-only changes accurately describe groupBy across count, sum, and average queries. The ungrouped empty-string map key and first-orderBy direction behavior match the query parsers, proof helpers, Drive dispatchers, and WASM map conversion code, and the prior count-only comment has been corrected.

Source: reviewer 1: glm-5.3-flash (agent: phase1-reviewer, role: general); reviewer 2: glm-5.3-flash (agent: phase1-reviewer, role: ffi-engineer); final verifier: gpt-5.6-sol (agent: sol-verifier, role: final-verifier)

Review provenance

  • Triage: trivial by gpt-6-astra (effort low) — The diff only updates JSDoc and internal comments describing aggregate query behavior, with no changes to executable logic, type signatures, or serialization.
  • Phase 1 reviewers: glm-5.3-flash — general (completed, effort high); agent phase1-reviewer, glm-5.3-flash — ffi-engineer (completed, effort high); agent phase1-reviewer
  • Fresh verifier: gpt-5.6-sol — final-verifier; agent sol-verifier
  • Phase 2 reviewers: not run (triage rated this change trivial); this review comments and never approves

@thepastaclaw thepastaclaw left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Final review — Phase 1 only (trivial change)

The documentation now consistently describes groupBy and orderBy as shared across count, sum, and average aggregate queries, including the ungrouped return shapes. The prior count-specific ordering comment has been corrected, and no in-scope issues remain.

Source: reviewer 1: gemini-3.8-flash-high (agent: phase1-reviewer, role: general); final verifier: gpt-5.6-sol (agent: sol-verifier, role: final-verifier)

Review provenance

  • Triage: trivial by gpt-6-astra (effort low) — The diff only clarifies aggregate-query JSDoc and internal comments, with no changes to executable logic, types, or query behavior.
  • Phase 1 reviewers: gemini-3.8-flash-high — general (completed, effort high); agent phase1-reviewer
  • Phase 1 model: gemini-3.8-flash-high — antigravity quota: weekly 94% left, 5h 65% left
  • Fresh verifier: gpt-5.6-sol — final-verifier; agent sol-verifier
  • Phase 2 reviewers: not run (triage rated this change trivial); this review comments and never approves

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants